package com.rz.htk.template.controller;

import com.rz.core.kit.RespKit;
import com.rz.core.resp.ResultResp;
import com.rz.htk.template.entity.Template;
import com.rz.htk.template.entity.vo.TemplateDeleteParam;
import com.rz.htk.template.service.ExportService;
import com.rz.htk.template.service.ITemplateService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.List;

/**
 * @ClassName TemplateController
 * @Description 模板controller
 * @Author maweiyue
 * @Date 2019/4/17 20:37
 */
@RestController
@RequestMapping("/template")
public class TemplateController {

    @Resource
    private ITemplateService templateService;

    @Resource
    private ExportService exportService;

    @PostMapping("/getPage")
    public ResultResp getPage(@RequestBody Template template){
        return RespKit.success(templateService.getPage(template));
    }

    @PostMapping("/saveTemplate")
    public ResultResp saveTemplate(@RequestBody Template template){
        return RespKit.success(templateService.saveTemplate(template));
    }

    @PostMapping("/batchDelete")
    public ResultResp batchDelete(@RequestBody TemplateDeleteParam prdDeleteParam){
        return RespKit.success(templateService.batchDelete(prdDeleteParam));
    }

    @PostMapping("getAll")
    public ResultResp getAll(){
        return RespKit.success(templateService.listAll());
    }

    @PostMapping("listByType/{type}")
    public ResultResp getAll(@PathVariable String type){
        return RespKit.success(templateService.listByType(type));
    }

}
